package com.zenghus.clint;

import com.zenghus.order.dal.entity.Order;
import com.zenghus.order.service.IOrderService;
import com.zenghus.user.dal.entity.User;
import com.zenghus.user.service.IUserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.Timestamp;
import java.util.Calendar;

@SpringBootApplication
@ImportResource(locations={"classpath:dubbo-clint.xml"})
public class App 
{
    public static void main( String[] args ) {

        ApplicationContext context=SpringApplication.run(App.class,args);
        //ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("dubbo-clint.xml");

        IUserService userService=(IUserService) context.getBean("userService");

        User user=new User();
        user.setUsername("username1手动阀23");
        user.setPassword("阿斯顿");
        userService.addUser(user);

        IOrderService orderService= (IOrderService) context.getBean("orderService");
        Order order=new Order();
        order.setCreateTime(new Timestamp(System.currentTimeMillis()));
        order.setUserId(1);
        order.setOrderNumber("12312");
        orderService.addOrder(order);

    }
}
